To reduce bandwidth occupied during video transmission, an encoding device needs to perform encoding processing on a video image, and correspondingly, a decoding device needs to perform decoding processing on video data received by the decoding device. An interframe compression method is a common video coding technology, which can perform compression processing on a to-be-transmitted video image, and can reduce an amount of data during video transmission.
The interframe compression method is a motion-estimation-based video coding technology. A process in which the encoding device encodes a video image includes first, dividing a to-be-coded video image into several equal-sized image blocks referred to as code blocks, then, dividing a code block to obtain image subblocks referred to as prediction blocks, and searching a reference image for an image block that best matches a current prediction block and using the image block as a reference block, then, performing a subtraction operation between corresponding pixel values of the current prediction block and the reference block to obtain a residual, and combining obtained residuals corresponding to all prediction blocks to obtain a residual of the to-be-coded video image, then, performing entropy coding on a value obtained by transforming and quantizing the residual of the to-be-coded video image, and finally, sending motion information and a bit stream that are obtained by means of entropy coding together to the decoding device. The motion information represents a difference between locations of the current prediction block and the reference block. After receiving the bit stream and the motion information that are sent by the encoding device, the decoding device performs a processing process inverse to that of the encoding device to obtain data corresponding to the original video image.
In the prior art, a prediction subblock technology is introduced so to obtain a more accurate reference motion vector. A basic idea of the prediction subblock technology is dividing a current prediction block into smaller prediction subblocks. For example, the current prediction block may be divided into multiple prediction subblocks of a smaller size (for example, the size is 8×8), and reference motion vectors are obtained from a reference image in units of prediction subblocks obtained by means of division. A current prediction block may be divided into multiple prediction subblocks using the prediction subblock technology in order to obtain more reference motion vectors, which can improve encoding quality.
However, the following two problems exist in the existing prediction subblock technology First, because a size of a prediction subblock is preset, for example, the size of a prediction subblock is preset to 8×8, when a size of a side of a prediction block is less than the preset size of a prediction subblock, the side is not divided. For example, when a size of a prediction block is 16×4, a size of a vertical side of the prediction block is 4 and is less than 8. Therefore, the vertical side is not divided, and in this case, the 16×4 prediction block is divided to obtain two prediction subblocks whose size is 8×4. When a size of a side of a prediction block is not a multiple of 8, the side is not divided. For example, when a size of a prediction block is 16×12, a size of a vertical side of the prediction block is 12 and is not a multiple of 8. Therefore, the vertical side is not divided, and in this case, the 16×12 prediction block is divided to obtain two prediction subblocks whose size is 8×12. For another example, when a size of a prediction block is 12×12, and a size of a prediction subblock is preset to 8×8, because neither a size of a horizontal side of the prediction block nor a size of a vertical side is a multiple of 8, a size of a prediction subblock obtained by means of division is still 12×12. A problem of such a division method is introducing some prediction subblocks whose sizes are not a size used in an existing encoding/decoding device, for example, a prediction subblock whose size is 8×12. However, before the prediction subblock technology is introduced, the blocks whose sizes are not the size used in the existing encoding/decoding device do not exist. Therefore, because some prediction subblock sizes are added due to the prediction subblock technology, implementation load on an encoding/decoding system is increased. Second, in the existing prediction subblock technology, prediction subblocks are all square, which cannot reflect texture of the prediction block, and this affects accuracy of an acquired reference motion vector.